<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h"%>
<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
<%@ taglib uri="http://myfaces.apache.org/tomahawk" prefix="t"%>
<%@ taglib uri="http://richfaces.org/a4j" prefix="a4j"%>
<%@ taglib uri="http://richfaces.org/rich" prefix="rich"%>
<%@ taglib uri="http://jakarta.apache.org/struts/tags-tiles"
	prefix="tiles"%>

<rich:panel header="#{messages['edit.membership']}">
	<h:panelGrid>
		<h:outputText value="#{errorBean.errorMessage}" styleClass="error"></h:outputText>
		<t:messages></t:messages>
	</h:panelGrid>

	<h:panelGrid width="100%">
		<h:outputText value="#{messages['membership.info']}" styleClass="sub_header" />
		<h:panelGroup>
			<h:outputText value="*" styleClass="standardText_Mandatory" />
			<h:outputText value="#{messages['instruction']}" styleClass="standardText_Instruction" />
		</h:panelGroup>
	</h:panelGrid>

	<t:panelGrid columns="2" columnClasses="standardTable_ColumnLeft_20,standardTable_ColumnLeft_80" width="100%">
		<h:outputText></h:outputText>
		<t:message for="code" styleClass="error"></t:message>
	
		<h:panelGroup>
			<h:outputText value="*" styleClass="standardText_Mandatory" />
			<h:outputLabel for="code" value="#{messages['membership.code']}" styleClass="standardText_Label" />
		</h:panelGroup>
		<h:panelGroup>
			<t:inputText id="code" required="true" size="50" maxlength="50" styleClass="standardText" value="#{adminMembershipBean.membership.code}"></t:inputText>
		</h:panelGroup>
		
		<h:outputText></h:outputText>
		<t:message for="name" styleClass="error"></t:message>
		
		<h:panelGroup>
			<h:outputText value="*" styleClass="standardText_Mandatory" />
			<h:outputLabel for="name" value="#{messages['membership.name']}" styleClass="standardText_Label" />
		</h:panelGroup>
		<h:panelGroup>
			<t:inputText id="name" required="true" size="50" maxlength="50" styleClass="standardText" value="#{adminMembershipBean.membership.name}"></t:inputText>
		</h:panelGroup>
		
		<h:outputText></h:outputText>
		<t:message for="desc" styleClass="error"></t:message>
		
		<h:panelGroup>
			<h:outputText value="*" styleClass="standardText_Mandatory" />
			<h:outputLabel for="desc" value="#{messages['membership.desc']}" styleClass="standardText_Label" />
		</h:panelGroup>
		<h:panelGroup>
			<t:inputTextarea id="desc" cols="20" rows="5" value="#{adminMembershipBean.membership.desc}"></t:inputTextarea>
		</h:panelGroup>
		
		<h:outputText></h:outputText>
		<t:message for="membershipterm" styleClass="error"></t:message>
	
		<h:panelGroup>
			<h:outputText value="*" styleClass="standardText_Mandatory" />
			<h:outputLabel for="membershipterm" value="#{messages['membership.term']}" styleClass="standardText_Label" />
		</h:panelGroup>
		<h:panelGroup>
			<t:inputText id="membershipterm" required="true" size="50" maxlength="50" styleClass="standardText" value="#{adminMembershipBean.membership.membershipTermInt}">
				<f:validateLength maximum="100" minimum="0"/>
			</t:inputText>
			<f:verbatim>&nbsp;</f:verbatim>
			<h:outputText styleClass="standardText_Label" value="#{messages['years']}"></h:outputText>
		</h:panelGroup>
		
		<h:outputText></h:outputText>
		<t:message for="membershiptype" styleClass="error"></t:message>
	
		<h:panelGroup>
			<h:outputText value="*" styleClass="standardText_Mandatory" />
			<h:outputLabel for="membershiptype" value="#{messages['membership.type']}" styleClass="standardText_Label" />
		</h:panelGroup>
		<h:panelGroup>
			<t:selectOneRadio id="membershiptype" styleClass="standardText" value="#{adminMembershipBean.membership.membershipType}" required="true">
				<f:selectItems value="#{adminMembershipBean.typeList}"/>
			</t:selectOneRadio>
		</h:panelGroup>
		
		<%--<h:outputText></h:outputText>
		<t:message for="image" styleClass="error"></t:message>
		
		<h:panelGroup>
			<h:outputText value="*" styleClass="standardText_Mandatory" />
			<h:outputLabel for="image" value="#{messages['membership.image']}" styleClass="standardText_Label" />
		</h:panelGroup>
		<h:panelGroup>
			<t:inputFileUpload id="image" storage="file" size="50"  required="true"></t:inputFileUpload>
		</h:panelGroup>--%>
	</t:panelGrid>
	
	<h:panelGrid width="100%">
		<h:outputText value="#{messages['membership.charges.info']}" styleClass="sub_header" />
	</h:panelGrid>

	<t:panelGrid columns="2" columnClasses="standardTable_ColumnLeft_20,standardTable_ColumnLeft_80" width="100%">
		<h:outputText></h:outputText>
		<t:message for="fee" styleClass="error"></t:message>
	
		<h:panelGroup>
			<h:outputText value="*" styleClass="standardText_Mandatory" />
			<h:outputLabel for="fee" value="#{messages['membership.fee']}" styleClass="standardText_Label" />
		</h:panelGroup>
		<h:panelGroup>
			<t:inputText id="fee" required="true" size="50" maxlength="50" styleClass="standardText" value="#{adminMembershipBean.membership.membershipFeeDbl}">
				<f:convertNumber pattern="##,###,##0.00"/>
			</t:inputText>
		</h:panelGroup>
		
		<h:outputText></h:outputText>
		<t:message for="annualMaintenance" styleClass="error"></t:message>
	
		<h:panelGroup>
			<h:outputText value="*" styleClass="standardText_Mandatory" />
			<h:outputLabel for="annualMaintenance" value="Annual Maintenance" styleClass="standardText_Label" />
		</h:panelGroup>
		<h:panelGroup>
			<t:inputText id="annualMaintenance" required="true" size="50" maxlength="50" styleClass="standardText" value="#{adminMembershipBean.membership.annualMaintenance}">
				<f:convertNumber pattern="##,###,##0.00" maxFractionDigits="2"/>
			</t:inputText>
		</h:panelGroup>
		
		<h:outputText></h:outputText>
		<t:message for="downpayment" styleClass="error"></t:message>
	
		<h:panelGroup>
			<h:outputText value="*" styleClass="standardText_Mandatory" />
			<h:outputLabel for="downpayment" value="#{messages['minimum.down.payment.percent']}" styleClass="standardText_Label" />
		</h:panelGroup>
		<h:panelGroup>
			<t:inputText id="downpayment" required="true" size="50" maxlength="50" styleClass="standardText" value="#{adminMembershipBean.membership.downPaymentPercentDbl}">
				<f:convertNumber pattern="##0.0"/>
				<f:validateLength maximum="100" minimum="0"/>
			</t:inputText>
			<f:verbatim>&nbsp;</f:verbatim>
			<h:outputText styleClass="standardText_Label" value="#{messages['percent']}"></h:outputText>
		</h:panelGroup>
		
	</t:panelGrid>
	
	<h:panelGrid width="100%">
		<h:outputText value="#{messages['entitlement.points']}" styleClass="sub_header" />
	</h:panelGrid>
	
	<t:dataTable var="point" value="#{adminMembershipBean.mapList}" width="100%">
			<t:column>
				<t:panelGrid columns="2" columnClasses="standardTable_ColumnLeft_20,standardTable_ColumnLeft_80" width="100%">
					
					<h:outputText></h:outputText>
					<t:message for="n" styleClass="error"></t:message>
					
					<h:panelGroup>
					<h:outputText value="*" styleClass="standardText_Mandatory" />
					<h:outputLabel for="n" value="#{point.pointCategory.name}" styleClass="standardText_Label" />
				</h:panelGroup>
				<h:panelGroup>
					<t:inputText id="n" required="true" size="50" maxlength="50" styleClass="standardText" value="#{point.point}">
					</t:inputText>
				</h:panelGroup>
					
				</t:panelGrid>
			</t:column>
			
			
	</t:dataTable>
	
	<h:panelGrid width="100%">
		<h:outputText value="#{messages['membership.entitlement.info']}" styleClass="sub_header" />
	</h:panelGrid>
	
	<t:panelGrid columns="2" columnClasses="standardTable_ColumnLeft_20,standardTable_ColumnLeft_80" width="100%">
	
		<h:outputText></h:outputText>
		<t:message for="membershipCat" styleClass="error"></t:message>
		<h:panelGroup>
			<h:outputText value="*" styleClass="standardText_Mandatory" />
			<h:outputLabel for="membershipCat" value="#{messages['membership.category']}" styleClass="standardText_Label" />
		</h:panelGroup>
		<h:panelGroup>
			<t:selectOneMenu id="membershipCat" styleClass="standardText" value="#{adminMembershipBean.catId}">
				<f:selectItem itemLabel="#{messages['please.select']}" itemValue="" />
				<f:selectItems value="#{adminMembershipBean.categoryList}"/>
			</t:selectOneMenu>
		</h:panelGroup>
		
		<h:outputText></h:outputText>
		<t:message for="maximumperson" styleClass="error"></t:message>
	
		<h:panelGroup>
			<h:outputText value="*" styleClass="standardText_Mandatory" />
			<h:outputLabel for="maximumperson" value="#{messages['maximum.person']}" styleClass="standardText_Label" />
		</h:panelGroup>
		<h:panelGroup>
			<t:inputText id="maximumperson" required="true" size="50" maxlength="50" styleClass="standardText" value="#{adminMembershipBean.membership.maxPersonInt}">
				<f:validateLength maximum="100" minimum="0"/>
			</t:inputText>
		</h:panelGroup>
		
		
		<%--<h:outputText></h:outputText>
		<t:message for="entitlementpoint" styleClass="error"></t:message>
	
		<h:panelGroup>
			<h:outputText value="*" styleClass="standardText_Mandatory" />
			<h:outputLabel for="entitlementpoint" value="#{messages['entitlement.points']}" styleClass="standardText_Label" />
		</h:panelGroup>
		<h:panelGroup>
			<t:inputText id="entitlementpoint" required="true" size="50" maxlength="50" styleClass="standardText" value="">
				<f:validateLength maximum="100" minimum="0"/>
			</t:inputText>
		</h:panelGroup>
		--%>
		
		<h:outputText></h:outputText>
		<t:message for="rcipointdec" styleClass="error"></t:message>
	
		<h:panelGroup>
			<h:outputText value="*" styleClass="standardText_Mandatory" />
			<h:outputLabel for="rcipointdec" value="#{messages['rci.point.deduction']}" styleClass="standardText_Label" />
		</h:panelGroup>
		<h:panelGroup>
			<t:inputText id="rcipointdec" required="true" size="50" maxlength="50" styleClass="standardText" value="#{adminMembershipBean.membership.rciPointDecInt}">
				<f:validateLength maximum="100" minimum="0"/>
			</t:inputText>
		</h:panelGroup>
		
		
	</t:panelGrid>
	
	<h:panelGrid width="100%">
		<h:outputText value="#{messages['other']}" styleClass="sub_header" />
		<h:panelGroup>
			<h:outputText value="*" styleClass="standardText_Mandatory" />
			<h:outputText value="#{messages['instruction']}" styleClass="standardText_Instruction" />
		</h:panelGroup>
	</h:panelGrid>
	
	<t:panelGrid columns="2" columnClasses="standardTable_ColumnLeft_20,standardTable_ColumnLeft_80" width="100%">
		<h:outputText></h:outputText>
		<t:message for="amortisescheme" styleClass="error"></t:message>
	
		<h:panelGroup>
			<h:outputText value="*" styleClass="standardText_Mandatory" />
			<h:outputLabel for="amortisescheme" value="#{messages['amortise.schema']}" styleClass="standardText_Label" />
		</h:panelGroup>
		<h:panelGroup>
			<t:selectOneMenu id="amortisescheme" styleClass="standardText" value="#{adminMembershipBean.schId}" required="true">
				<f:selectItem itemLabel="#{messages['please.select']}" itemValue="" />
				<f:selectItems value="#{adminMembershipBean.amortiseList}"/>
			</t:selectOneMenu>
		</h:panelGroup>
		
		<h:outputText></h:outputText>
		<t:message for="effectivedate" styleClass="error"></t:message>
	
	    <h:panelGroup>
	    	<h:outputText value="*" styleClass="standardText_Mandatory" />	
		    <h:outputLabel for="effectivedate" value="#{messages['effective.date']}" styleClass="standardText_Label" />
	    </h:panelGroup>
	    <h:panelGroup>
	    	<t:inputCalendar
	    	id="effectivedate"
				monthYearRowClass="yearMonthHeader" weekRowClass="weekHeader" 
				currentDayCellClass="currentDayCell" value="#{adminMembershipBean.membership.effectivedate}"
				renderAsPopup="true" popupTodayString="#{messages['popup.today']}"
				popupWeekString="#{messages['popup.week']}" popupDateFormat="dd/MM/yyyy"
				renderPopupButtonAsImage="true"
				styleClass="standardText" required="true">
	    	</t:inputCalendar>
	    </h:panelGroup>
	    
	    <h:outputText></h:outputText>
		<t:message for="expirydate" styleClass="error"></t:message>
	
	    <h:panelGroup>
	    	<h:outputText value="*" styleClass="standardText_Mandatory" />	
		    <h:outputLabel for="expirydate" value="#{messages['expiry.date']}" styleClass="standardText_Label" />
	    </h:panelGroup>
	    <h:panelGroup>
	    	<t:inputCalendar
	    	id="expirydate"
				monthYearRowClass="yearMonthHeader" weekRowClass="weekHeader" 
				currentDayCellClass="currentDayCell" value="#{adminMembershipBean.membership.expirydate}"
				renderAsPopup="true" popupTodayString="#{messages['popup.today']}"
				popupWeekString="#{messages['popup.week']}" popupDateFormat="dd/MM/yyyy"
				renderPopupButtonAsImage="true"
				styleClass="standardText" required="true">
	    	</t:inputCalendar>
	    </h:panelGroup>
		
		
	</t:panelGrid>
	
	<rich:spacer height="30"></rich:spacer>
	
	<t:panelGrid columns="2" columnClasses="standardTable_ColumnLeft_20,standardTable_ColumnLeft_80" width="100%">
		<h:outputText></h:outputText>
		<t:panelGrid columns="2">
			<h:commandButton value="#{messages['update']}" styleClass="button" action="#{adminMembershipBean.editAction}"></h:commandButton>
			<h:commandButton value="#{messages['back']}" styleClass="button" action="#{adminMembershipBean.navListAction}" immediate="true"></h:commandButton>
		</t:panelGrid>
	</t:panelGrid>
	
</rich:panel>